package com.yao.mapper;

import com.yao.pojo.Category;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CategoryMapper {

    /**
     * 查找所有文章分类
     * @return
     */
    @Select("select * from category")
    List<Category> getAllCategory();

    /**
     * 新增文章分类
     * @param category
     */
    void insertCategory(Category category);

    /**
     * 根据分类ID查询分类信息
     * @param id
     * @return
     */
    @Select("select * from category where id = #{id}")
    Category selectCategoryById(Integer id);

    /**
     * 根据分类ID修改分类信息
     * @param categoryParam
     */
    void changeCategory(Category categoryParam);

    /**
     * 根据分类ID删除分类
     * @param id
     */
    @Delete("delete from category where id = #{id}")
    void deleteCategoryById(Integer id);
}
